﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace _06_ProgressBar
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        /// <summary>
        /// 增加
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            if (this.progressBar1.Value<100)
            {
                this.progressBar1.Value += 10;
                this.label2.Text = (this.progressBar1.Value * 1.0 / this.progressBar1.Maximum * 100).ToString("F2") + "%";
            }
        }
        /// <summary>
        /// 减少
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            if (this.progressBar1.Value > 0)
            {
                this.progressBar1.Value -= 10;
                this.label2.Text = (this.progressBar1.Value * 1.0 / this.progressBar1.Maximum * 100).ToString("F2") + "%";
            }
        }

        private void button3_Click(object sender, EventArgs e)
        {
            this.progressBar1.Value = 0;
            this.label2.Text = "0MS";
        }
    }
}
